package com.sskj.fca.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.fca.http.HttpConfig;
import com.sskj.fca.ui.fragment.UpdatePwdFragment;


public class UpdatePwdFragmentPresenter extends BasePresenter<UpdatePwdFragment> {

    /**
     * 重置密码
     *
     * @param oldpwd 旧密码
     * @param opwd   新密码
     * @param opwd1  确认密码
     */
    public void pwdReset(String oldpwd, String opwd, String opwd1) {
        httpService.pwdReset(oldpwd, opwd, opwd1)
                .tag(this)
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        HttpData httpData = response.body();
                        ToastUtil.showShort(httpData.msg);
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.changeSuccess();
                        }
                    }
                });
    }

}
